
import { ModalForm, ProFormDigit, ProFormGroup, ProFormList, ProFormText } from '@ant-design/pro-components';
import { Form, Modal } from 'antd';
import { CloseCircleOutlined } from '@ant-design/icons';

export default function KeyboardGroupDialog({children, onFinish}) {
  const [form] = Form.useForm();
  return (
    <ModalForm
      title="新建表单"
      trigger={children}
      form={form}
      modalProps={{
        destroyOnClose: true,
      }}
      submitTimeout={2000}
      onFinish={values => {
        onFinish(values)
        return true
      }}
    >
        <ProFormList
          name="key_list"
          copyIconProps={false}
          deleteIconProps={{
            Icon: CloseCircleOutlined,
          }}
          initialValue={[
            {key: "", interval: 1}
          ]}
        >
          <ProFormGroup key="group">
            <ProFormText name="key" width="xs" placeholder={"键名"} />
            <ProFormDigit name="interval" width="xs" placeholder={"间隔"}/>
          </ProFormGroup>
        </ProFormList>
      
    </ModalForm>
  )
}